package com.bosssoft.hr.train.springmvc.example.controller;

import com.bosssoft.hr.train.springmvc.example.model.User;
import com.bosssoft.hr.train.springmvc.example.util.result.Result;
import com.bosssoft.hr.train.springmvc.example.util.ResultUtil;
import org.springframework.web.bind.annotation.*;

/**
 * @description 各种Controller Request请求测试
 * @author ChenTong
 * @date 2020/6/5
 */
@RestController
@RequestMapping("/params")
public class ParamController {
/**
    //请求参数绑定：使用别名
    @GetMapping("/params1")
    public String params3(@RequestParam(value = "number",required = true) Integer id){
        return "id:"+id;
    }

    //请求参数绑定 @PathVariable、@CookieValue、@RequestHeader
    @GetMapping("/params2/{name}")
    public Result<String> params4(@PathVariable("name") String str,
                          @CookieValue("JSESSIONID") String cookie,
                          @RequestHeader("Accept-Encoding") String header){
        return ResultUtil.success("str:"+str+" cookie:"+cookie+" header:"+header);
    }

    //请求参数绑定：对象属性自动封装
    @PostMapping("/params3")
    public Result<String> params5(User user){
        return ResultUtil.success("id:"+user.getId()+" name:"+user.getName()+" age:"+user.getCode());
    }
**/

}
